/* Allegro */
#include <allegro.h>

/* Standard includes */
#include <stdio.h>

/* Own includes */
#include "../include/global.h"

void text_center(int xpos, int ypos, int r, int b, int g, char * text)
{
    /* Create shadow */
        textprintf_centre_ex(buffer, font, xpos + 1, ypos + 1,
        makecol(0, 0, 0), -1, text);

    /* Print text */
    textprintf_centre_ex(buffer, font, xpos, ypos,
        makecol(r, b, g), -1, text);
}

void debuginfo(int posx, int posy)
{
    char * mpox = malloc(sizeof(mouse_x + 3));
    char * mpoy = malloc(sizeof(mouse_y + 3));

    sprintf(mpox, "X:%d", mouse_x);
    sprintf(mpoy, "Y:%d", mouse_y);

    textprintf_ex(buffer, font, posx, posy,
        makecol(255, 0, 0),
            0, mpox);

    textprintf_ex(buffer, font, posx, posy + 10,
        makecol(255, 0, 0),
            0, mpoy);

    textprintf_ex(buffer, font, posx + 50, posy,
        makecol(255, 0, 0),
            0, "MouseBtn:");


    switch(mouse_b)
    {
        case 0:
        {
            textprintf_ex(buffer, font, posx + 125, posy,
                makecol(255, 0, 0),
                    0, "none");
        } break;
        case 1:
        {
            textprintf_ex(buffer, font, posx + 125, posy,
                makecol(255, 0, 0),
                    0, "left");
        } break;
        case 2:
        {
            textprintf_ex(buffer, font, posx + 125, posy,
                makecol(255, 0, 0),
                    0, "right");
        } break;
    }

    free(mpox);
    free(mpoy);
}
